---
layout: "default"
description: "Swift documentation for 'FloatingPointSign'"
root: "/v5.1"
title: "FloatingPointSign"
keywords: ""
---

<div class="intro-declaration"><code class="language-swift">enum FloatingPointSign</code></div><p>The sign of a floating-point value.</p>
<table class="standard"><tr><th id="inheritance">Inheritance</th><td><code class="inherits">Int, Codable, CustomReflectable, Hashable, SIMDScalar</code></td></tr><tr><th id="aliases">Associated Types</th><td><span id="aliasesmark"></span><div class="declaration"><code class="language-swift">public typealias SIMDMaskScalar = Int</code><div class="comment"></div></div></td></tr><tr><th>Nested Types</th><td><code class="nested">Int.SIMD2Storage, Int.SIMD4Storage, Int.SIMD8Storage, Int.SIMD16Storage, Int.SIMD32Storage, Int.SIMD64Storage</code></td></tr></table><div class="discussion comment"></div><h3>Cases</h3><div id="minus-dabe6e597b70e5760826aea1dcc564f7" class="declaration"><a class="toggle-link" href="#comment-minus-dabe6e597b70e5760826aea1dcc564f7">case minus</a> <span class="required">Required</span><div class="comment collapse in" id="comment-minus-dabe6e597b70e5760826aea1dcc564f7"><p>The sign for a negative value.</p>
<h4>Declaration</h4><code class="language-swift">case minus</code></div></div><div id="plus-d7d18cfb3a0d8293e2f5d94ea30e04d2" class="declaration"><a class="toggle-link" href="#comment-plus-d7d18cfb3a0d8293e2f5d94ea30e04d2">case plus</a> <span class="required">Required</span><div class="comment collapse in" id="comment-plus-d7d18cfb3a0d8293e2f5d94ea30e04d2"><p>The sign for a positive value.</p>
<h4>Declaration</h4><code class="language-swift">case plus</code></div></div><h3>Initializers</h3><div id="init-e67906ab4373125a18eb2b5a75f59bd2" class="declaration"><a class="toggle-link" href="#comment-init-e67906ab4373125a18eb2b5a75f59bd2">init init()</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-e67906ab4373125a18eb2b5a75f59bd2"><p>Creates a vector with zero in all lanes.</p>
<h4>Declaration</h4><code class="language-swift">public init()</code></div></div><div id="init-e67906ab4373125a18eb2b5a75f59bd2" class="declaration"><a class="toggle-link" href="#comment-init-e67906ab4373125a18eb2b5a75f59bd2">init init()</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-e67906ab4373125a18eb2b5a75f59bd2"><p>Creates a vector with zero in all lanes.</p>
<h4>Declaration</h4><code class="language-swift">public init()</code></div></div><div id="init-e67906ab4373125a18eb2b5a75f59bd2" class="declaration"><a class="toggle-link" href="#comment-init-e67906ab4373125a18eb2b5a75f59bd2">init init()</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-e67906ab4373125a18eb2b5a75f59bd2"><p>Creates a vector with zero in all lanes.</p>
<h4>Declaration</h4><code class="language-swift">public init()</code></div></div><div id="init-e67906ab4373125a18eb2b5a75f59bd2" class="declaration"><a class="toggle-link" href="#comment-init-e67906ab4373125a18eb2b5a75f59bd2">init init()</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-e67906ab4373125a18eb2b5a75f59bd2"><p>Creates a vector with zero in all lanes.</p>
<h4>Declaration</h4><code class="language-swift">public init()</code></div></div><div id="init-e67906ab4373125a18eb2b5a75f59bd2" class="declaration"><a class="toggle-link" href="#comment-init-e67906ab4373125a18eb2b5a75f59bd2">init init()</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-e67906ab4373125a18eb2b5a75f59bd2"><p>Creates a vector with zero in all lanes.</p>
<h4>Declaration</h4><code class="language-swift">public init()</code></div></div><div id="init-e67906ab4373125a18eb2b5a75f59bd2" class="declaration"><a class="toggle-link" href="#comment-init-e67906ab4373125a18eb2b5a75f59bd2">init init()</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init-e67906ab4373125a18eb2b5a75f59bd2"><p>Creates a vector with zero in all lanes.</p>
<h4>Declaration</h4><code class="language-swift">public init()</code></div></div><div id="init_bitPattern-4bde68cf851d5f81e7bf04fa5bd275a1" class="declaration"><a class="toggle-link" href="#comment-init_bitPattern-4bde68cf851d5f81e7bf04fa5bd275a1">init init(bitPattern:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_bitPattern-4bde68cf851d5f81e7bf04fa5bd275a1"><p>Creates a new value with the bit pattern of the given pointer.</p>
<p>The new value represents the address of the pointer passed as <code>pointer</code>.
If <code>pointer</code> is <code>nil</code>, the result is <code>0</code>.</p>
<ul>
<li>Parameter pointer: The pointer to use as the source for the new
integer.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public init(bitPattern pointer: OpaquePointer?)</code></div></div><div id="init_bitPattern-4bde68cf851d5f81e7bf04fa5bd275a1" class="declaration"><a class="toggle-link" href="#comment-init_bitPattern-4bde68cf851d5f81e7bf04fa5bd275a1">init init(bitPattern:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_bitPattern-4bde68cf851d5f81e7bf04fa5bd275a1"><p>Creates an integer that captures the full value of the given object
identifier.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public init(bitPattern objectID: ObjectIdentifier)</code></div></div><div id="init_bitPattern-4bde68cf851d5f81e7bf04fa5bd275a1" class="declaration"><a class="toggle-link" href="#comment-init_bitPattern-4bde68cf851d5f81e7bf04fa5bd275a1">init init(bitPattern:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_bitPattern-4bde68cf851d5f81e7bf04fa5bd275a1"><p>Creates a new value with the bit pattern of the given pointer.</p>
<p>The new value represents the address of the pointer passed as <code>pointer</code>.
If <code>pointer</code> is <code>nil</code>, the result is <code>0</code>.</p>
<ul>
<li>Parameter pointer: The pointer to use as the source for the new
integer.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public init&lt;P>(bitPattern pointer: P?) where P: _Pointer</code></div></div><div id="init_from-ac2c581668ee6074e8eee083d88ea873" class="declaration"><a class="toggle-link" href="#comment-init_from-ac2c581668ee6074e8eee083d88ea873">init init(from:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_from-ac2c581668ee6074e8eee083d88ea873"><p>Creates a new instance by decoding from the given decoder.</p>
<p>This initializer throws an error if reading from the decoder fails, or
if the data read is corrupted or otherwise invalid.</p>
<ul>
<li>Parameter decoder: The decoder to read data from.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public init(from decoder: Decoder) throws</code></div></div><div id="init_rawValue-d16a3c3e47fae7437ff5bc15a3063a32" class="declaration"><a class="toggle-link" href="#comment-init_rawValue-d16a3c3e47fae7437ff5bc15a3063a32">init init?(rawValue:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-init_rawValue-d16a3c3e47fae7437ff5bc15a3063a32"><p>Creates a new instance with the specified raw value.</p>
<p>If there is no value of the type that corresponds with the specified raw
value, this initializer returns <code>nil</code>. For example:</p>
<pre><code class="language-swift">enum PaperSize: String {
    case A4, A5, Letter, Legal
}

print(PaperSize(rawValue: &quot;Legal&quot;))
// Prints &quot;Optional(&quot;PaperSize.Legal&quot;)&quot;

print(PaperSize(rawValue: &quot;Tabloid&quot;))
// Prints &quot;nil&quot;
</code></pre>
<ul>
<li>Parameter rawValue: The raw value to use for the new instance.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public init?(rawValue: Int)</code></div></div><h3>Instance Variables</h3><div id="customMirror-c4bea5adb1649887b1a7e9972736e2a9" class="declaration"><a class="toggle-link" href="#comment-customMirror-c4bea5adb1649887b1a7e9972736e2a9">var customMirror</a> <span class="required">Required</span><div class="comment collapse in" id="comment-customMirror-c4bea5adb1649887b1a7e9972736e2a9"><p>A mirror that reflects the <code>Int</code> instance.</p>
<h4>Declaration</h4><code class="language-swift">var customMirror: Mirror</code></div></div><div id="customPlaygroundQuickLook-f9753f8429ddbf38426ca2eda101c4d3" class="declaration"><a class="toggle-link" href="#comment-customPlaygroundQuickLook-f9753f8429ddbf38426ca2eda101c4d3">var customPlaygroundQuickLook</a> <span class="required">Required</span><div class="comment collapse in" id="comment-customPlaygroundQuickLook-f9753f8429ddbf38426ca2eda101c4d3"><p>A custom playground Quick Look for the <code>Int</code> instance.</p>
<h4>Declaration</h4><code class="language-swift">var customPlaygroundQuickLook: _PlaygroundQuickLook</code></div></div><div id="hashValue-491de0d7adc95987fe9b96f8ce8b5ed1" class="declaration"><a class="toggle-link" href="#comment-hashValue-491de0d7adc95987fe9b96f8ce8b5ed1">var hashValue</a> <span class="required">Required</span><div class="comment collapse in" id="comment-hashValue-491de0d7adc95987fe9b96f8ce8b5ed1"><p>The hash value.</p>
<p>Hash values are not guaranteed to be equal across different executions of
your program. Do not save hash values to use during a future execution.</p>
<blockquote>
<p>Important:
<code>hashValue</code> is deprecated as a <code>Hashable</code> requirement. To conform to <code>Hashable</code>, implement the <code>hash(into:)</code> requirement instead.</p>
</blockquote>
<h4>Declaration</h4><code class="language-swift">var hashValue: Int</code></div></div><div id="rawValue-05d5e54af177d42e80ca02e20dada809" class="declaration"><a class="toggle-link" href="#comment-rawValue-05d5e54af177d42e80ca02e20dada809">var rawValue</a> <span class="required">Required</span><div class="comment collapse in" id="comment-rawValue-05d5e54af177d42e80ca02e20dada809"><p>The corresponding value of the raw type.</p>
<p>A new instance initialized with <code>rawValue</code> will be equivalent to this
instance. For example:</p>
<pre><code class="language-swift">enum PaperSize: String {
    case A4, A5, Letter, Legal
}

let selectedSize = PaperSize.Letter
print(selectedSize.rawValue)
// Prints &quot;Letter&quot;

print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
// Prints &quot;true&quot;
</code></pre>
<h4>Declaration</h4><code class="language-swift">var rawValue: Int</code></div></div><div id="scalarCount-2c88ac4714aa7276da0950dfc969879e" class="declaration"><a class="toggle-link" href="#comment-scalarCount-2c88ac4714aa7276da0950dfc969879e">var scalarCount</a> <span class="required">Required</span><div class="comment collapse in" id="comment-scalarCount-2c88ac4714aa7276da0950dfc969879e"><p>The number of scalars, or elements, in the vector.</p>
<h4>Declaration</h4><code class="language-swift">var scalarCount: Int</code></div></div><div id="scalarCount-2c88ac4714aa7276da0950dfc969879e" class="declaration"><a class="toggle-link" href="#comment-scalarCount-2c88ac4714aa7276da0950dfc969879e">var scalarCount</a> <span class="required">Required</span><div class="comment collapse in" id="comment-scalarCount-2c88ac4714aa7276da0950dfc969879e"><p>The number of scalars, or elements, in the vector.</p>
<h4>Declaration</h4><code class="language-swift">var scalarCount: Int</code></div></div><div id="scalarCount-2c88ac4714aa7276da0950dfc969879e" class="declaration"><a class="toggle-link" href="#comment-scalarCount-2c88ac4714aa7276da0950dfc969879e">var scalarCount</a> <span class="required">Required</span><div class="comment collapse in" id="comment-scalarCount-2c88ac4714aa7276da0950dfc969879e"><p>The number of scalars, or elements, in the vector.</p>
<h4>Declaration</h4><code class="language-swift">var scalarCount: Int</code></div></div><div id="scalarCount-2c88ac4714aa7276da0950dfc969879e" class="declaration"><a class="toggle-link" href="#comment-scalarCount-2c88ac4714aa7276da0950dfc969879e">var scalarCount</a> <span class="required">Required</span><div class="comment collapse in" id="comment-scalarCount-2c88ac4714aa7276da0950dfc969879e"><p>The number of scalars, or elements, in the vector.</p>
<h4>Declaration</h4><code class="language-swift">var scalarCount: Int</code></div></div><div id="scalarCount-2c88ac4714aa7276da0950dfc969879e" class="declaration"><a class="toggle-link" href="#comment-scalarCount-2c88ac4714aa7276da0950dfc969879e">var scalarCount</a> <span class="required">Required</span><div class="comment collapse in" id="comment-scalarCount-2c88ac4714aa7276da0950dfc969879e"><p>The number of scalars, or elements, in the vector.</p>
<h4>Declaration</h4><code class="language-swift">var scalarCount: Int</code></div></div><div id="scalarCount-2c88ac4714aa7276da0950dfc969879e" class="declaration"><a class="toggle-link" href="#comment-scalarCount-2c88ac4714aa7276da0950dfc969879e">var scalarCount</a> <span class="required">Required</span><div class="comment collapse in" id="comment-scalarCount-2c88ac4714aa7276da0950dfc969879e"><p>The number of scalars, or elements, in the vector.</p>
<h4>Declaration</h4><code class="language-swift">var scalarCount: Int</code></div></div><h3>Subscripts</h3><div id="subscript_index-293ad0a56dee4ecca71b95ccc73897e9" class="declaration"><a class="toggle-link" href="#comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9">subscript subscript(index:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9"><p>Accesses the element at the specified index.</p>
<ul>
<li>Parameter index: The index of the element to access. <code>index</code> must be in
the range <code>0..&lt;scalarCount</code>.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public subscript(index: Int) -> Int</code></div></div><div id="subscript_index-293ad0a56dee4ecca71b95ccc73897e9" class="declaration"><a class="toggle-link" href="#comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9">subscript subscript(index:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9"><p>Accesses the element at the specified index.</p>
<ul>
<li>Parameter index: The index of the element to access. <code>index</code> must be in
the range <code>0..&lt;scalarCount</code>.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public subscript(index: Int) -> Int</code></div></div><div id="subscript_index-293ad0a56dee4ecca71b95ccc73897e9" class="declaration"><a class="toggle-link" href="#comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9">subscript subscript(index:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9"><p>Accesses the element at the specified index.</p>
<ul>
<li>Parameter index: The index of the element to access. <code>index</code> must be in
the range <code>0..&lt;scalarCount</code>.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public subscript(index: Int) -> Int</code></div></div><div id="subscript_index-293ad0a56dee4ecca71b95ccc73897e9" class="declaration"><a class="toggle-link" href="#comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9">subscript subscript(index:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9"><p>Accesses the element at the specified index.</p>
<ul>
<li>Parameter index: The index of the element to access. <code>index</code> must be in
the range <code>0..&lt;scalarCount</code>.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public subscript(index: Int) -> Int</code></div></div><div id="subscript_index-293ad0a56dee4ecca71b95ccc73897e9" class="declaration"><a class="toggle-link" href="#comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9">subscript subscript(index:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9"><p>Accesses the element at the specified index.</p>
<ul>
<li>Parameter index: The index of the element to access. <code>index</code> must be in
the range <code>0..&lt;scalarCount</code>.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public subscript(index: Int) -> Int</code></div></div><div id="subscript_index-293ad0a56dee4ecca71b95ccc73897e9" class="declaration"><a class="toggle-link" href="#comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9">subscript subscript(index:)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-subscript_index-293ad0a56dee4ecca71b95ccc73897e9"><p>Accesses the element at the specified index.</p>
<ul>
<li>Parameter index: The index of the element to access. <code>index</code> must be in
the range <code>0..&lt;scalarCount</code>.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public subscript(index: Int) -> Int</code></div></div><h3>Instance Methods</h3><div id="advanced_by-eca6cfea7368ad69605cb85a19cee2ca" class="declaration"><a class="toggle-link" href="#comment-advanced_by-eca6cfea7368ad69605cb85a19cee2ca">func advanced(by n: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-advanced_by-eca6cfea7368ad69605cb85a19cee2ca"><p>Returns a value that is offset the specified distance from this value.</p>
<p>Use the <code>advanced(by:)</code> method in generic code to offset a value by a
specified distance. If you're working directly with numeric values, use
the addition operator (<code>+</code>) instead of this method.</p>
<p>For a value <code>x</code>, a distance <code>n</code>, and a value <code>y = x.advanced(by: n)</code>,
<code>x.distance(to: y) == n</code>.</p>
<ul>
<li>Parameter n: The distance to advance this value.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public func advanced(by n: Int) -> Int</code></div></div><div id="distance_to-55ea9db2502ccb9247fb4f931340a7ef" class="declaration"><a class="toggle-link" href="#comment-distance_to-55ea9db2502ccb9247fb4f931340a7ef">func distance(to other: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-distance_to-55ea9db2502ccb9247fb4f931340a7ef"><p>Returns the distance from this value to the given value, expressed as a
stride.</p>
<p>For two values <code>x</code> and <code>y</code>, and a distance <code>n = x.distance(to: y)</code>,
<code>x.advanced(by: n) == y</code>.</p>
<ul>
<li>Parameter other: The value to calculate the distance to.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public func distance(to other: Int) -> Int</code></div></div><div id="encode_to-8c7f999a44e91e36e6d67e62075ffdbb" class="declaration"><a class="toggle-link" href="#comment-encode_to-8c7f999a44e91e36e6d67e62075ffdbb">func encode(to encoder: Encoder) throws</a> <span class="required">Required</span><div class="comment collapse in" id="comment-encode_to-8c7f999a44e91e36e6d67e62075ffdbb"><p>Encodes this value into the given encoder.</p>
<p>This function throws an error if any values are invalid for the given
encoder's format.</p>
<ul>
<li>Parameter encoder: The encoder to write data to.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">public func encode(to encoder: Encoder) throws</code></div></div><div id="hash_into-6d50cb3daa41162a12fb4542a687b393" class="declaration"><a class="toggle-link" href="#comment-hash_into-6d50cb3daa41162a12fb4542a687b393">func hash(into hasher: inout Hasher)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-hash_into-6d50cb3daa41162a12fb4542a687b393"><p>Hashes the essential components of this value by feeding them into the
given hasher.</p>
<p>Implement this method to conform to the <code>Hashable</code> protocol. The
components used for hashing must be the same as the components compared
in your type's <code>==</code> operator implementation. Call <code>hasher.combine(_:)</code>
with each of these components.</p>
<blockquote>
<p>Important:
Never call <code>finalize()</code> on <code>hasher</code>. Doing so may become a compile-time error in the future.</p>
</blockquote>
<ul>
<li>Parameter hasher: The hasher to use when combining the components
of this instance.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public func hash(into hasher: inout Hasher)</code></div></div><div id="hash_into-6d50cb3daa41162a12fb4542a687b393" class="declaration"><a class="toggle-link" href="#comment-hash_into-6d50cb3daa41162a12fb4542a687b393">func hash(into hasher: inout Hasher)</a> <span class="required">Required</span><div class="comment collapse in" id="comment-hash_into-6d50cb3daa41162a12fb4542a687b393"><p>Hashes the essential components of this value by feeding them into the
given hasher.</p>
<ul>
<li>Parameter hasher: The hasher to use when combining the components
of this instance.</li>
</ul>
<h4>Declaration</h4><code class="language-swift">@inlinable public func hash(into hasher: inout Hasher)</code></div></div><h3>Type Methods</h3><div id="lhs_rhs-a11d959272146d3130283768d9e59136" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-a11d959272146d3130283768d9e59136">func %(lhs: Int, rhs: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-a11d959272146d3130283768d9e59136"><p>Returns the remainder of dividing the first value by the second.</p>
<p>The result of the remainder operator (<code>%</code>) has the same sign as <code>lhs</code> and
has a magnitude less than <code>rhs.magnitude</code>.</p>
<pre><code class="language-swift">let x = 22 % 5
// x == 2
let y = 22 % -5
// y == 2
let z = -22 % -5
// z == -2
</code></pre>
<p>For any two integers <code>a</code> and <code>b</code>, their quotient <code>q</code>, and their remainder
<code>r</code>, <code>a == b * q + r</code>.</p>
<h4>Declaration</h4><code class="language-swift">public static func %(lhs: Int, rhs: Int) -> Int</code></div></div><div id="lhs_rhs-8e394094eebf256a06c74c30008a9a9c" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-8e394094eebf256a06c74c30008a9a9c">func &amp;(lhs: Int, rhs: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-8e394094eebf256a06c74c30008a9a9c"><p>Returns the result of performing a bitwise AND operation on the two given
values.</p>
<p>A bitwise AND operation results in a value that has each bit set to <code>1</code>
where <em>both</em> of its arguments have that bit set to <code>1</code>. For example:</p>
<pre><code class="language-swift">let x: UInt8 = 5          // 0b00000101
let y: UInt8 = 14         // 0b00001110
let z = x &amp; y             // 0b00000100
// z == 4
</code></pre>
<h4>Declaration</h4><code class="language-swift">public static func &amp;(lhs: Int, rhs: Int) -> Int</code></div></div><div id="lhs_rhs-ab0857b5da3983a56b05a0dadb0a089e" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-ab0857b5da3983a56b05a0dadb0a089e">func &amp;&lt;&lt;(lhs: Int, rhs: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-ab0857b5da3983a56b05a0dadb0a089e"><p>Returns the result of shifting a value's binary representation the
specified number of digits to the left, masking the shift amount to the
type's bit width.</p>
<p>Use the masking left shift operator (<code>&amp;&lt;&lt;</code>) when you need to perform a
shift and are sure that the shift amount is in the range
<code>0..&lt;lhs.bitWidth</code>. Before shifting, the masking left shift operator
masks the shift to this range. The shift is performed using this masked
value.</p>
<p>The following example defines <code>x</code> as an instance of <code>UInt8</code>, an 8-bit,
unsigned integer type. If you use <code>2</code> as the right-hand-side value in an
operation on <code>x</code>, the shift amount requires no masking.</p>
<pre><code class="language-swift">let x: UInt8 = 30                 // 0b00011110
let y = x &amp;&lt;&lt; 2
// y == 120                       // 0b01111000
</code></pre>
<p>However, if you use <code>8</code> as the shift amount, the method first masks the
shift amount to zero, and then performs the shift, resulting in no change
to the original value.</p>
<pre><code class="language-swift">let z = x &amp;&lt;&lt; 8
// z == 30                        // 0b00011110
</code></pre>
<p>If the bit width of the shifted integer type is a power of two, masking
is performed using a bitmask; otherwise, masking is performed using a
modulo operation.</p>
<h4>Declaration</h4><code class="language-swift">public static func &amp;&lt;&lt;(lhs: Int, rhs: Int) -> Int</code></div></div><div id="lhs_rhs-0e7fea1a22e5e436fc50aeb0bd9eef22" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-0e7fea1a22e5e436fc50aeb0bd9eef22">func &amp;>>(lhs: Int, rhs: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-0e7fea1a22e5e436fc50aeb0bd9eef22"><p>Returns the result of shifting a value's binary representation the
specified number of digits to the right, masking the shift amount to the
type's bit width.</p>
<p>Use the masking right shift operator (<code>&amp;&gt;&gt;</code>) when you need to perform a
shift and are sure that the shift amount is in the range
<code>0..&lt;lhs.bitWidth</code>. Before shifting, the masking right shift operator
masks the shift to this range. The shift is performed using this masked
value.</p>
<p>The following example defines <code>x</code> as an instance of <code>UInt8</code>, an 8-bit,
unsigned integer type. If you use <code>2</code> as the right-hand-side value in an
operation on <code>x</code>, the shift amount requires no masking.</p>
<pre><code class="language-swift">let x: UInt8 = 30                 // 0b00011110
let y = x &amp;&gt;&gt; 2
// y == 7                         // 0b00000111
</code></pre>
<p>However, if you use <code>8</code> as the shift amount, the method first masks the
shift amount to zero, and then performs the shift, resulting in no change
to the original value.</p>
<pre><code class="language-swift">let z = x &amp;&gt;&gt; 8
// z == 30                        // 0b00011110
</code></pre>
<p>If the bit width of the shifted integer type is a power of two, masking
is performed using a bitmask; otherwise, masking is performed using a
modulo operation.</p>
<h4>Declaration</h4><code class="language-swift">public static func &amp;>>(lhs: Int, rhs: Int) -> Int</code></div></div><div id="lhs_rhs-471d936295383220ce00ec7c8a571f42" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-471d936295383220ce00ec7c8a571f42">func *(lhs: Int, rhs: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-471d936295383220ce00ec7c8a571f42"><p>Multiplies two values and produces their product.</p>
<p>The multiplication operator (<code>*</code>) calculates the product of its two
arguments. For example:</p>
<pre><code class="language-swift">2 * 3                   // 6
100 * 21                // 2100
-10 * 15                // -150
3.5 * 2.25              // 7.875
</code></pre>
<p>You cannot use <code>*</code> with arguments of different types. To multiply values
of different types, convert one of the values to the other value's type.</p>
<pre><code class="language-swift">let x: Int8 = 21
let y: Int = 1000000
Int(x) * y              // 21000000
</code></pre>
<p>The product of the two arguments must be representable in the arguments'
type. In the following example, the result of <code>21 * 21</code> is greater than
the maximum representable <code>Int8</code> value:</p>
<pre><code class="language-swift">x * 21                  // Overflow error
</code></pre>
<blockquote>
<p>Note:
Overflow checking is not performed in <code>-Ounchecked</code> builds.</p>
</blockquote>
<p>If you want to opt out of overflow checking and wrap the result in case
of any overflow, use the overflow multiplication operator (<code>&amp;*</code>).</p>
<pre><code class="language-swift">x &amp;* 21                // -115
</code></pre>
<h4>Declaration</h4><code class="language-swift">public static func *(lhs: Int, rhs: Int) -> Int</code></div></div><div id="lhs_rhs-1ace6c0ccceecc18799beae40fae2402" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-1ace6c0ccceecc18799beae40fae2402">func +(lhs: Int, rhs: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-1ace6c0ccceecc18799beae40fae2402"><p>Adds two values and produces their sum.</p>
<p>The addition operator (<code>+</code>) calculates the sum of its two arguments. For
example:</p>
<pre><code class="language-swift">1 + 2                   // 3
-10 + 15                // 5
-15 + -5                // -20
21.5 + 3.25             // 24.75
</code></pre>
<p>You cannot use <code>+</code> with arguments of different types. To add values of
different types, convert one of the values to the other value's type.</p>
<pre><code class="language-swift">let x: Int8 = 21
let y: Int = 1000000
Int(x) + y              // 1000021
</code></pre>
<p>The sum of the two arguments must be representable in the arguments'
type. In the following example, the result of <code>21 + 120</code> is greater than
the maximum representable <code>Int8</code> value:</p>
<pre><code class="language-swift">x + 120                 // Overflow error
</code></pre>
<blockquote>
<p>Note:
Overflow checking is not performed in <code>-Ounchecked</code> builds.</p>
</blockquote>
<p>If you want to opt out of overflow checking and wrap the result in case
of any overflow, use the overflow addition operator (<code>&amp;+</code>).</p>
<pre><code class="language-swift">x &amp;+ 120                // -115
</code></pre>
<h4>Declaration</h4><code class="language-swift">public static func +(lhs: Int, rhs: Int) -> Int</code></div></div><div id="lhs_rhs-d3d9eeb5284a9f8a3101d48d6c5f5dde" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-d3d9eeb5284a9f8a3101d48d6c5f5dde">func -(lhs: Int, rhs: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-d3d9eeb5284a9f8a3101d48d6c5f5dde"><p>Subtracts one value from another and produces their difference.</p>
<p>The subtraction operator (<code>-</code>) calculates the difference of its two
arguments. For example:</p>
<pre><code class="language-swift">8 - 3                   // 5
-10 - 5                 // -15
100 - -5                // 105
10.5 - 100.0            // -89.5
</code></pre>
<p>You cannot use <code>-</code> with arguments of different types. To subtract values
of different types, convert one of the values to the other value's type.</p>
<pre><code class="language-swift">let x: UInt8 = 21
let y: UInt = 1000000
y - UInt(x)             // 999979
</code></pre>
<p>The difference of the two arguments must be representable in the
arguments' type. In the following example, the result of <code>21 - 50</code> is
less than zero, the minimum representable <code>UInt8</code> value:</p>
<pre><code class="language-swift">x - 50                  // Overflow error
</code></pre>
<blockquote>
<p>Note:
Overflow checking is not performed in <code>-Ounchecked</code> builds.</p>
</blockquote>
<p>If you want to opt out of overflow checking and wrap the result in case
of any overflow, use the overflow subtraction operator (<code>&amp;-</code>).</p>
<pre><code class="language-swift">x &amp;- 50                // 227
</code></pre>
<h4>Declaration</h4><code class="language-swift">public static func -(lhs: Int, rhs: Int) -> Int</code></div></div><div id="lhs_rhs-8d3e01dd5aadf72b5d7233c057966993" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-8d3e01dd5aadf72b5d7233c057966993">func /(lhs: Int, rhs: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-8d3e01dd5aadf72b5d7233c057966993"><p>Returns the quotient of dividing the first value by the second.</p>
<p>For integer types, any remainder of the division is discarded.</p>
<pre><code class="language-swift">let x = 21 / 5
// x == 4
</code></pre>
<h4>Declaration</h4><code class="language-swift">public static func /(lhs: Int, rhs: Int) -> Int</code></div></div><div id="lhs_rhs-cc639dad42d3ea71f6f367b80a3ccb92" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-cc639dad42d3ea71f6f367b80a3ccb92">func &lt;=(lhs: Int, rhs: Int) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-cc639dad42d3ea71f6f367b80a3ccb92"><p>Returns a Boolean value indicating whether the value of the first
argument is less than or equal to that of the second argument.</p>
<h4>Declaration</h4><code class="language-swift">public static func &lt;=(lhs: Int, rhs: Int) -> Bool</code></div></div><div id="a_b-ad60eb2dc6987c96e58372c8bc490914" class="declaration"><a class="toggle-link" href="#comment-a_b-ad60eb2dc6987c96e58372c8bc490914">func ==(a: FloatingPointSign, b: FloatingPointSign) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-a_b-ad60eb2dc6987c96e58372c8bc490914"><p>Returns a Boolean value indicating whether two values are equal.</p>
<p>Equality is the inverse of inequality. For any values <code>a</code> and <code>b</code>,
<code>a == b</code> implies that <code>a != b</code> is <code>false</code>.</p>
<h4>Declaration</h4><code class="language-swift">@inlinable public static func ==(a: FloatingPointSign, b: FloatingPointSign) -> Bool</code></div></div><div id="lhs_rhs-a00561663d495dd2668b929fde178932" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-a00561663d495dd2668b929fde178932">func >(lhs: Int, rhs: Int) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-a00561663d495dd2668b929fde178932"><p>Returns a Boolean value indicating whether the value of the first
argument is greater than that of the second argument.</p>
<h4>Declaration</h4><code class="language-swift">public static func >(lhs: Int, rhs: Int) -> Bool</code></div></div><div id="lhs_rhs-a0e01127094d0eee401411c4b5eb8e60" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-a0e01127094d0eee401411c4b5eb8e60">func >=(lhs: Int, rhs: Int) -> Bool</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-a0e01127094d0eee401411c4b5eb8e60"><p>Returns a Boolean value indicating whether the value of the first
argument is greater than or equal to that of the second argument.</p>
<h4>Declaration</h4><code class="language-swift">public static func >=(lhs: Int, rhs: Int) -> Bool</code></div></div><div id="lhs_rhs-03f47400539569672fd3bb01c98ae9b6" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-03f47400539569672fd3bb01c98ae9b6">func ^(lhs: Int, rhs: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-03f47400539569672fd3bb01c98ae9b6"><p>Returns the result of performing a bitwise XOR operation on the two given
values.</p>
<p>A bitwise XOR operation, also known as an exclusive OR operation, results
in a value that has each bit set to <code>1</code> where <em>one or the other but not
both</em> of its arguments had that bit set to <code>1</code>. For example:</p>
<pre><code class="language-swift">let x: UInt8 = 5          // 0b00000101
let y: UInt8 = 14         // 0b00001110
let z = x ^ y             // 0b00001011
// z == 11
</code></pre>
<h4>Declaration</h4><code class="language-swift">public static func ^(lhs: Int, rhs: Int) -> Int</code></div></div><div id="lhs_rhs-4e71b0d2abd7c5dbfd95249811ea3f9a" class="declaration"><a class="toggle-link" href="#comment-lhs_rhs-4e71b0d2abd7c5dbfd95249811ea3f9a">func |(lhs: Int, rhs: Int) -> Int</a> <span class="required">Required</span><div class="comment collapse in" id="comment-lhs_rhs-4e71b0d2abd7c5dbfd95249811ea3f9a"><p>Returns the result of performing a bitwise OR operation on the two given
values.</p>
<p>A bitwise OR operation results in a value that has each bit set to <code>1</code>
where <em>one or both</em> of its arguments have that bit set to <code>1</code>. For
example:</p>
<pre><code class="language-swift">let x: UInt8 = 5          // 0b00000101
let y: UInt8 = 14         // 0b00001110
let z = x | y             // 0b00001111
// z == 15
</code></pre>
<h4>Declaration</h4><code class="language-swift">public static func |(lhs: Int, rhs: Int) -> Int</code></div></div>